The present invention relates to a method and/or architecture for reading a potentiometer generally and, more particularly, to a method and/or architecture for accurately reading a potentiometer with a microprocessor.
Conventional low cost Universal Serial Bus (USB) joysticks are inaccurate. Such inaccuracy is not acceptable for the end user. Improved accuracy of conventional USB joysticks require numerous (and costly) external components.
In particular, conventional low cost solutions for reading a potentiometer rely on RC discharge timing. Such approaches are inherently inaccurate due to potentiometer errors when operating in 2-terminal mode. Readings obtained from the potentiometers operated in this mode vary with supply voltage and are subject to noise, drift and temperature variation. Thus, the readings have limited accuracy and this inaccuracy manifests itself as crosshair jitter and drifting of the joystick center position. Another source of error in the conventional approach occurs due to microprocessor measurements of the RC (charge or discharge time).
In one version of the conventional approach, the period of time to charge a capacitor through the variable resistor from 0V to an input logic level threshold of the microcontroller CMOS input is measured. Such an approach introduces additional inaccuracy. Inaccuracy is introduced when measuring the time interval. Also, inaccuracy arises from variations in the level of the voltage source used to charge the capacitor through the variable resistor.
It would be desirable to provide a method and/or apparatus for accurately reading a potentiometer that adds a minimal cost to the circuit.
The present invention concerns a method for reading a position of a wiper on a potentiometer, comprising the steps of (A) charging a capacitor connected to a wiper terminal of the potentiometer, (B) discharging the capacitor through a particular terminal of the potentiometer, (C) measuring a first time taken to discharge the capacitor from a first voltage to a second voltage, (D) recharging the capacitor, (E) discharging the capacitor through another particular terminal of the potentiometer, (F) measuring a second time taken to discharge the capacitor from the first voltage to the second voltage, (G) reading the position of the wiper by calculating a ratio of the times measured in steps (C) and (F).
The objects, features and advantages of the present invention include providing a method and/or architecture for accurately reading a potentiometer that may (i) be cost-effective; (ii) use a microcontroller I/O cell with two input logic level thresholds to measure a time period for a changing input voltage to move from one threshold to another threshold in order to obtain a reading; and/or (iii) use any digital logic input having two thresholds to obtain a reading.